{% extends 'base.html' %}
{% block title %}更新{% endblock %}
{% block content %}
<div class="container">
  <div class="panel panel-default" style="margin-top: 20px;">
    <div class="panel-heading" style="background-color: #ff6b81; color: white;">
      更新 {{ order.id }}
    </div>
    <div class="panel-body" style="background-color: #fff0f5;">
      <form method="post">
        {% csrf_token %}
        <div class="form-group">
          <label for="id" class="hidden">id</label>
          <input type="hidden" id="id" name="id" value="{{ order.id }}" class="form-control"/>
        </div>
        <div class="form-group">
          <label for="title">名称</label>
          <input type="text" id="title" name="title" value="{{ order.title }}" class="form-control" readonly/>
        </div>
        <div class="form-group">
          <label for="price">价格</label>
          <input type="text" id="price" name="price" value="{{ order.price }}" class="form-control"/>
        </div>
        <div class="form-group">
          <label for="status">状态</label>
          <select id="status" name="status" class="form-control">
            {% if order.status == 1 %}
              <option value="{{ order.status }}" selected>待支付</option>
            {% else %}
              <option value="1">待支付</option>
            {% endif %}
            {% if order.status == 2 %}
              <option value="{{ order.status }}" selected>已支付</option>
            {% else %}
              <option value="2">已支付</option>
            {% endif %}
          </select>
          <span class='error-msg' style="color: red;"></span>
        </div>
        <div class="form-group">
          <label for="empno">用户</label>
          <select id="empno" name="empno" class="form-control">
            <option value="">--请选择--</option>
            {% for emp in emp_list %}
              {% if emp.empno == order.emp_id %}
                <option value="{{ emp.empno }}" selected>{{ emp.ename }}</option>
              {% else %}
                <option value="{{ emp.empno }}">{{ emp.ename }}</option>
              {% endif %}
            {% endfor %}
          </select>
          <span class='error-msg' style="color: red;"></span>
        </div>
        <button class="btn btn-primary" style="background-color: #ff6b81; border: none;">修改</button>
      </form>
    </div>
  </div>
</div>
{% endblock %}
{% block js %}
<script type="text/javascript">
  $(function(){
    $("#hiredate").datepicker({
      format: 'yyyy-mm-dd',
      language: 'zh-CN',
      autoclose: true,
      todayHighlight: true,
      todayBtn: true
    });
  });
</script>
{% endblock %}
